﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Wys.DataForm.CSharp.SoftWare
{
    public partial class SelectedForm : Wys.Control.Vb.AutoAdjustFrom
    {
        public SelectedForm()
        {
            InitializeComponent();
        }

        private string _文件夹路径 = "";

        public string 文件夹路径
        {
            get
            {
                return _文件夹路径;
            }
            set
            {
                _文件夹路径 = value;
            }
        }

        private void SelectedForm_Load(object sender, EventArgs e)
        {
            int count = 0;
            if(System.IO.File.Exists(_文件夹路径))
            {
                System.IO.DirectoryInfo dif = new System.IO.DirectoryInfo(System.IO.Path.GetDirectoryName(_文件夹路径));
                foreach(System.IO.FileInfo fif in dif.GetFiles("*"+System.IO.Path.GetExtension(_文件夹路径)))
                {
                    this.myDataView1.Rows.Add(new object[] { (++count).ToString(), fif.Name, fif.FullName,"打开"});
                }
      
            }
        }

        private void myDataView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == 3)
            {
                String strFile = myDataView1.Rows[e.RowIndex].Cells[2].Value.ToString();
                UTIL.CUtil.OpenFile(strFile);
            }
        }       
    }
}
